#!/bin/bash
if test -z "$arch"; then
	arch="i486"
	export arch
fi
VERSION=`date '+%Y%m%d'`
PKG=odcommon
USR="--owner 1000 --group 1000 --same-permissions "
EXCLUDE=" --exclude '*~' --exclude .svn "

cd libraries
make clean && make || exit 1
cd ..

echo "Common files" > pkg/$PKG.desc
cp pkg/*.desc ./var/pkg

chmod 0770 usr/local/opendomo/services/syscript/editSystemState.sh
chmod o-rwx -R usr/local/opendomo/services/control/setSystemState.sh
chmod o-rwx -R usr/local/opendomo/services/syscript/configureMap.sh

rm -fr pkg/o*.tar.gz

chmod o-rwx usr/local/opendomo/services/config/*.sh
tar cfz ./pkg/$PKG-$VERSION.od.$arch.tar.gz var etc usr $USR $EXCLUDE


